package com.heimali.happyreader;

import com.heimali.happyreader.config.CommonConfig;
import com.heimali.happyreader.config.Constants;

public class Statics {
	public static String UID = "0";
	public static String USERNAME = "";
	public static String TOKEN = "";
	public static boolean IS_SYNC_DATA = false;  //是否从网上同步过数据
	
	public static boolean isLogin() {
		return CommonConfig.getInstance().getConfig(Constants.COMMON_CONFIG_IS_LOGIN, false);
	}
	
	public static void logout() {
		CommonConfig.getInstance().setConfig(Constants.COMMON_CONFIG_IS_LOGIN, false);
	}
	
	public static String getUid() {
		if ("0".equals(UID)) {
			UID = CommonConfig.getInstance().getConfig(Constants.COMMON_CONFIG_UID, "0");
		}
		return UID;
	}
	
	public static String getUsername() {
		if ("".equals(USERNAME)) {
			USERNAME = CommonConfig.getInstance().getConfig(Constants.COMMON_CONFIG_USERNAME);
		}
		return USERNAME;
	}
	
	public static String getToken() {
		if ("".equals(TOKEN)) {
			TOKEN = CommonConfig.getInstance().getConfig(Constants.COMMON_CONFIG_TOKEN);
		}
		return TOKEN;
	}
}
